package view.PlantUml;

import java.util.Map;

import view.interfaces.Iview;

import Model.interfaces.Iassociation;
import Model.interfaces.Idiagrame;

public class PlantUmlcombination implements Iview{
private Idiagrame dia;
private String source="";
	@Override
	public void addDiagram(Idiagrame diagram) {
		this.dia=diagram;
		
	}

	@Override
	public void convert() {
		for(Map.Entry<String, Iassociation> ass: dia.listAssociation().entrySet()){
			
			source+="object "+ass.getValue().getupper().getName()+" -- "+"object "+ass.getValue().getLower().getName()+" : "+ass.getValue().getFunctionality()+"\n";
		}
		
	}

	@Override
	public String getCode() {
		
		return "@startuml\n"+source+"@enduml\n";
	}

}
